home *** CD-ROM | disk | FTP | other *** search
- <HTML>
- <HEAD>
- <TITLE>Navigating Page Elements in IE4</TITLE>
- </HEAD>
-
- <BODY BGCOLOR=white>
-
- <P>
- <IMG ID=arrow SRC="arrow.gif" ALIGN=left">
- <FONT FACE="Arial, Helvetica" SIZE=+2>
- Navigating Page Elements in IE4
- </FONT>
- </P>
-
- <P>The following is the document structure of this web page:
-
- <BLOCKQUOTE>
- <PRE><SCRIPT>
- function enumerateChildElements(pageElement)
- {
- var i = pageElement.sourceIndex + 1;
-
- // Display the root element
- document.writeln(pageElement.tagName);
-
- // Display elements sequentially while they
- // are still contained by pageElement.
- //
- while (i < document.all.length &&
- pageElement.contains(document.all[i]))
- {
- // Indent the element three spaces for each
- // parent between the current element and
- // root element
- //
- parentElement = document.all[i].parentElement;
- while (parentElement != pageElement && parentElement != null)
- {
- parentElement = parentElement.parentElement;
- document.write(" ");
- }
-
- // Display the tag name and move to the next element
- document.writeln(" " + document.all[i].tagName);
- i++;
- }
- }
-
- enumerateChildElements(document.all[0]);
- </SCRIPT></PRE>
- </BLOCKQUOTE>
- </P>
-
- </BODY>
- </HTML>
-